<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<h:form id="formTeacherData" prependId="false"  >
		<script type="text/javascript" src="#{request.contextPath}/css/script/script.js"/>

		<h:panelGrid  columns="2" style="width:50;min-height:90%;height:90%"  columnClasses="top-align,top-align"   >   
			<h:column >
				<h:panelGrid columns="2" cellpadding="2" > 

		            <h:outputLabel value="#{msgs.Email} :" for="teacherEmail" />
		            <p:inputText id="teacherEmail" value="#{teacherBean.teacher.user.email}" maxlength ="50" size="50" required="true" requiredMessage="#{msgs.EmailObligatory}"/>

		            			
					<h:outputLabel value="#{msgs.Password} :"	for="teacherPassword" />
					<p:password id="teacherPassword" autocomplete="off"	redisplay="true"
						value="#{ teacherBean.teacher.user.password}" maxlength="15"	size="15" required="true" requiredMessage="#{msgs.PasswordObligatory}"/>
		
		            <h:outputLabel value="#{msgs.FirstName} :" for="teacherFirstName"  />
		            <p:inputText id="teacherFirstName"    value="#{teacherBean.teacher.firstName}" maxlength ="20" size="20" required="false"  requiredMessage="{msgs.TeacherNameObligatory"/>

		            <h:outputLabel value="#{msgs.Surname} :" for="teacherSurname"  />
		            <p:inputText id="teacherSurname"    value="#{teacherBean.teacher.lastName}" maxlength ="50" size="50" required="false"  requiredMessage="{msgs.TeacherSurnameObligatory"/>

		            <h:outputLabel value="#{msgs.Phone} :" for="teacherPhone" styleClass="sp_celphones" />
		            <p:inputText id="teacherPhone" 	value="#{teacherBean.teacher.user.phone}" maxlength ="22" size="22" styleClass="sp_celphones"  />
		
		            <h:outputLabel value="#{msgs.CPF} :" for="teacherCpf" />
		            <p:inputText id="teacherCpf" 	value="#{teacherBean.teacher.cpf}" maxlength ="22" size="22" required="false"  styleClass="cpf" requiredMessage="#{msgs.CpfObligatory}"   />

	   	        	<h:outputLabel value="#{msgs.Gender} :" for="teacherMale" />
		            <p:selectOneMenu id="teacherMale" value="#{teacherBean.teacher.male}"  >
		                <f:selectItem itemLabel="#{msgs.Male}"  	itemValue="true"   />
		                <f:selectItem itemLabel="#{msgs.Female}"	itemValue="false" />
		            </p:selectOneMenu>
	
		            <h:outputText value="#{msgs.Status} :" />
		            <p:selectOneRadio value="#{teacherBean.teacher.user.active}" >
		                <f:selectItem itemLabel="#{msgs.Active}"  	itemValue="true"   />
		                <f:selectItem itemLabel="#{msgs.Inactive}"	itemValue="false" />
		            </p:selectOneRadio>
	
					<h:outputLabel 	value="#{msgs.CreatedAt} :"		for="teacherCreatedAt" rendered="#{teacherBean.teacher.id != null}"  />
					<p:inputText  	id="teacherCreatedAt" 	value="#{teacherBean.teacher.user.createdAt}" disabled="true" rendered="#{teacherBean.teacher.id != null}"   >
						<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />
					</p:inputText>
	
					<h:outputLabel 	value="#{msgs.ChangedAt} :"		for="teacherChangedAt" rendered="#{teacherBean.teacher.id != null}"  />
					<p:inputText  	id="teacherChangedAt" 	value="#{teacherBean.teacher.user.lastChange}" disabled="true" rendered="#{teacherBean.teacher.id != null}"  >
						<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />
					</p:inputText>
	
					<h:outputLabel 	value="#{msgs.ExpireOn} :"		for="teacherExpireOn" rendered="#{p:ifAnyGranted('ROLE_ACADEMY')}" />
					<p:calendar		id="teacherExpireOn"	value="#{teacherBean.teacher.user.expireOn}"	navigator="true" yearRange="c-10:c+10"
						locale="pt"		timeZone="Brazil/East" selectOtherMonths="true"  readonlyInput="true" readOnlyInputText="true" required="true" requiredMessage="#{msgs.ExpireOnObligatory}" 
						rendered="#{p:ifAnyGranted('ROLE_ACADEMY')}"  />
	
				</h:panelGrid>
			</h:column>
			<h:column>
				<div align="center" style="width:100%">
					<p:commandLink oncomplete="wdlgupload.show();" process="@this"  >
						<p:graphicImage  id="photoTeacher"  title="#{msgs.Photo} 120px x 100px"  cache="false" 	
							url="#{teacherBean.teacher.photo.folder}#{teacherBean.teacher.photo.location}" height="120px" width="100px" style="border:1px solid;"/>
							<f:setPropertyActionListener  value="#{3}" target="#{teacherBean.uploadType}" />
					</p:commandLink>
				</div>
			</h:column>
		</h:panelGrid>
		<div align="left"   >
			<p:commandButton  value="#{msgs.Save}"		action="#{teacherBean.saveTeacher}"		
				ajax="true"	update=":growl,:content, :listTeacherForm"		icon="ui-icon-disk"	rendered="#{teacherBean.teacher.id != null}" />
			<p:commandButton  value="#{msgs.Create}"	action="#{teacherBean.createTeacher}"	 
				ajax="true"	update=":growl,:content, :listTeacherForm"		icon="ui-icon-document"	rendered="#{teacherBean.teacher.id == null}" />
			<p:spacer width="50px"/>	
			<p:commandButton  value="#{msgs.Cancel}"	action="#{teacherBean.cancelChange}"	icon="ui-icon-cancel"/>
		</div>
	</h:form>
</html>